package io.github.cunyu1943;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 *
 * @Package : io.github.cunyu1943
 * @ClassName : Palindromes.java
 * @CreateTime : 2022/11/27 20:17
 * @Version : 1.0
 * @Author : 村雨遥
 * @Email : 747731461@qq.com
 * @公众号 : 村雨遥
 * @Website : https://cunyu1943.github.io/JavaPark
 * @Description : 回文数
 */
public class Palindromes {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        System.out.println("输入一个整数");

        // 输入的初始值
        int num = in.nextInt();
        // 临时记录
        int tmp = num;
        // 反转后的数
        int reverse = 0;

        while (num != 0) {
            int x = num % 10;
            num /= 10;
            reverse = reverse * 10 + x;
        }

        System.out.println(tmp + " 是一个回文数 ：" + (reverse == tmp));

    }
}
